package com.gobang.modules.login;

import com.gobang.modules.message.MsgHandler;
import com.gobang.proto.GameProto.*;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 登录控制器
 * 处理登录相关的消息
 */
@Slf4j
@Component
public class LoginController {

    @Autowired
    private LoginService loginService;

    /**
     * 处理登录请求
     */
    @MsgHandler(MessageType.LOGIN_REQUEST)
    public void onLogin(ChannelHandlerContext ctx, LoginRequest request) {
        loginService.handleLogin(ctx, request);
    }
}
